package com.best.core.entity;

import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @ClassName: CommonPageResult
 * @Package: com.best.core.entity
 * @Description: 统一返回分页参数实体类（分页）
 * @Datetime: 2020/6/5 17:54
 * @Author: nike
 */
@Data
@ApiModel(value = "统一返回分页参数实体类")
public class CommonPageResult<T> {
    /**
     * 返回数据条数
     */
    @ApiModelProperty(value = "数据条数")
    private Long total;
    /**
     * 返回数据集合
     */
    @ApiModelProperty(value = "数据集合")
    private List<T> datas;

    public CommonPageResult() {}

    public CommonPageResult(Long total, List<T> datas) {
        this.total = total;
        this.datas = datas;
    }

    public static <T> CommonPageResult buildPageResult(Long total, List<T> datas) {
        return new CommonPageResult<T>(total, datas);
    }
}
